/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version 2.0;
    format ascii;
    class dictionary;
    location system;
    object snappyHexMeshDict;
}

    surfaceLevel 6;
    lineLevel 8; 
    prismLayer 5;

    castellatedMesh true;
    snap true;
    addLayers true;
    geometry
    {
        wing_lower.stl
        {
            type triSurfaceMesh;
            name  wing_lower;
        }
        wing_upper.stl
        {
            type triSurfaceMesh;
            name  wing_upper;
        }
        wing_tip.stl
        {
            type triSurfaceMesh;
            name  wing_tip;
        }
        wing_te.stl
        {
            type triSurfaceMesh;
            name  wing_te;
        }
    }

    castellatedMeshControls
    {
        features
        (
            {
                file "wing_lower.eMesh";
                level $lineLevel;
            }

            {
                file "wing_upper.eMesh";
                level $lineLevel;
            }

            {
                file "wing_tip.eMesh";
                level $lineLevel;
            }

            {
                file "wing_te.eMesh";
                level $lineLevel;
            }
        );
        refinementSurfaces
        {
            wing_upper
            {
                level ( $surfaceLevel $surfaceLevel );
            }
            
            wing_lower
            {
                level ( $surfaceLevel $surfaceLevel );
            }
            
            wing_te
            {
                level ( $surfaceLevel $surfaceLevel );
            }
            
            wing_tip
            {
                level ( $surfaceLevel $surfaceLevel );
            }
 
        }

        refinementRegions
        {

           
        }

        locationInMesh ( 2 2 2 );
        maxLocalCells 10000000;
        maxGlobalCells 200000000;
        minRefinementCells 0;
        nCellsBetweenLevels 3;
        resolveFeatureAngle 10;
        allowFreeStandingZoneFaces true;
        planarAngle 30;
        maxLoadUnbalance 0.10;
    }

    snapControls
    {
        nSolveIter 50;
        nSmoothPatch 3;
        tolerance 2.0;
        nRelaxIter 5;
        nFeatureSnapIter 10;
        implicitFeatureSnap false;
        explicitFeatureSnap true;
        multiRegionFeatureSnap false;
    }

    addLayersControls
    {
        layers
        {
            "wing.*"
            {nSurfaceLayers $prismLayer;}
        }

        relativeSizes true;
        expansionRatio 1.3;
        finalLayerThickness 0.3;
        minThickness 0.001;
        nGrow 0;
        featureAngle 180;
        slipFeatureAngle 80;
        nRelaxIter 5;
        nSmoothSurfaceNormals 1;
        nSmoothNormals 3;
        nSmoothThickness 10;
        maxFaceThicknessRatio 0.5;
        maxThicknessToMedialRatio 0.3;
        minMedialAxisAngle 90;
        nBufferCellsNoExtrude 0;
        nLayerIter 50;
        nRelaxedIter 20;
        writeVTK false;
        noErrors false;
        layerRecovery 1;
        growZoneLayers false;
        projectGrownUp 0.0;
    }

    meshQualityControls
    {
        maxNonOrtho 60;
        maxBoundarySkewness 4;
        maxInternalSkewness 4;
        maxConcave 80;
        minFlatness 0.5;
        minVol 1.00E-13;
        minTetQuality -1e30;
        minArea -1;
        minTwist 0.03;
        minDeterminant 0.01;
        minFaceWeight 0.03;
        minVolRatio 0.01;
        minTriangleTwist -1;
        nSmoothScale 4;
        errorReduction 0.75;
        relaxed {maxNonOrtho 65; maxBoundarySkewness 5; }

    }

    debug 0;
    mergeTolerance 1E-6;
    autoBlockMesh false;
